<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%-- <%@ page import="java.text.SimpleDateFormat"%>  --%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>查询发展会员列表</title>
<%@ include file="/common/importLib.jsp" %>
<script type="text/javascript" src="../common/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">

	/**
	 * 增删改查参数设置
	 */
	/* toolbarView = 0; 
	tableWidth = "100%";
	tableHeight = $(window).height()-110; */
	tablePageSize=5;
	var updateWidth = 800; //修改窗口宽度
	var updateHeight = 450; //修改窗口高度
	var tableTitle = "分销代理申请";
    updateTitle = "分销代理资料审核"; //修改标题
	tableURL = getTimeURL("../share/shareApply/listShareApplyInfo.do");
	tableColumns = [[
	                {field:'id',title:'id',width:0,rowspan:1},
	                {field:'opt',title:'审核操作',width:130,align:'center', rowspan:1,
						formatter:function(value,rowData,rowIndex){	
							var queryUrl = '../maintain/userInfo/queryById.do?id=' + rowData.userId;						
							return "<a title='修改' class='xxl_linkbutton' iconCls='icon-edit' href='javascript:datagridUpdate(\"" + queryUrl + "\")'>审核操作</a>";
						}
					},	
					{field:'loginCode',title:'申请人账号',width:120,rowspan:1},	
					{field:'userName',title:'申请人姓名',width:100,rowspan:1},
					{field:'mobilePhone',title:'手机号码',width:150,rowspan:1},		
					{field:'idCard',title:'身份证号',width:150,rowspan:1},
					{field:'accupation',title:'申请人职业',width:100,rowspan:1},
					{field:'bankAccount',title:'银行卡号',width:100,rowspan:1},		
					{field:'bankType',title:'所属银行',width:100,rowspan:1},
					{field:'applyTime',title:'申请时间',width:150,rowspan:1},
					{field:'auditTime',title:'审核时间',width:150,rowspan:1},
					{field:'auditstatus',title:'审核状态',width:150,rowspan:1}
					]];
	$(function(){
		$("#exportXls").on('click',exportXls);
		
	});
	
	
	/**
	 * 初始化修改表单
	 */
	function initUpdateForm(jsonObject){
		$("#idUpdate").val(jsonObject.id);
		$("#loginCodeUpdate").html(jsonObject.loginCode);
		$("#userNameUpdate").val(jsonObject.userName);		
		$("#mobilePhoneUpdate").val(jsonObject.mobilePhone);
		$("#accupationUpdate").val(jsonObject.accupation);
		$("#bankAccountUpdate").val(jsonObject.bankAccount);
		$("#bankTypeUpdate").val(jsonObject.bankType);	
		$("#idCardUpdate").val(jsonObject.idCard);		
		$("#recommendCodeUpdate").val(jsonObject.recommendCode);		
		$("#auditOpinionUpdate").val(jsonObject.auditOpinion);
		updateFormProcess("userName","用户");	
		
	}
	
	function searchTable() {
		var tid = Number($('#teacherId').combobox('getValue'));
		if(!tid){
			$.messager.alert('提示', '该老师不存在，请选择已有列表中的老师!');
		}else{
			var form = $('#searchForm');
			$("#datagrid_table").datagrid("load", serializeForm(form));
			
			$.ajax({
				type:"post",
				url:getTimeURL("../maintain/userInfo/getMemberListTotalAdmin.do"),
				data:serializeForm(form),
				dataType:"json",
				success:function(data){
					$("#totalNum").html(data.total);
					$("#totalMoney").html(data.money);
				}
			});
		}
	}
	
	function exportXls(){
		var startTime = $("#starttime").val();
		var endTime = $("#endtime").val();
		var message = '';
		if(startTime){
			message = startTime + "至" + endTime;
		}else{
			if(endTime){
				message = "至" + endTime ;
			}else{
				message = "所有";
			}
		}
		$.messager.confirm('导出', '是否导出当前老师名下发展会员的表格（时间段：'+ message +'）？' ,function(r){
			if(r){
				var teacherId = Number($('#teacherId').combobox('getValue'));
				location.href=getTimeURL("../maintain/userInfo/exportMemberListByTeacher.do?startTime="+startTime+"&endTime="+endTime+"&id="+teacherId);		
			}
		});
   } 

</script>
</head>
<body id="layout" class="easyui-layout">
	<div style="background: none repeat scroll 0% 0% #EFEFEF; height:100px; padding: 6px 2px; border-bottom: 1px solid #CCC;"
		region="north"  split="false" title="条件查询">
	<form  id="searchForm" >
	<table>
		<tr>
			<td width ="10px;"></td> <td><span style="font-size: 15px;color: red;">发展总人数：</span></td><td><span style="font-size:20px;color:green" id="totalNum">0</span><span style="font-size: 15px;color: red;">&nbsp;人</span></td>			
			<td width ="30px;"></td>
			<td>申请时间：</td>
			<td><input type="text" name="startTime" id="starttime" style="width: 86px;" class="input-style" onclick="WdatePicker({el:'starttime',maxDate:'#F{$dp.$D(\'endtime\')}'})"/>
				<span style="padding: 0 6px 0 2px;">至</span><input type="text" name ="endTime" id="endtime"  style="width: 86px;" class="input-style" onclick="WdatePicker({el:'endtime',minDate:'#F{$dp.$D(\'starttime\')}'})"/>
				</td>
			<td width="50px;"></td>
			<td>老师类型：</td><td><input type="text" name="typeId" id="typeId"/></td>
		</tr>
		<tr>		
			<td width ="10px;"></td><td><span style="font-size: 15px;color: red;">提成总额：</span></td><td><span style="font-size:20px;color:green" id="totalMoney">0</span><span style="font-size: 15px;color: red;">&nbsp;元</span></td>	
			<td width ="30px;"></td>
			<td>老师姓名：</td><td><input type="text" name="id" id="teacherId"/></td>	
			<td width="50px;"></td>
			<td><a class="easyui-linkbutton" id="search" iconCLs="icon-search"  onclick="searchTable();">搜索</a></td>
			<!--<td><a class="easyui-linkbutton" iconCls="icon-undo" onclick="document.getElementById('searchForm').reset();">清空</a></td>-->
			<td><a class="easyui-linkbutton" iconCLs="icon-excel" id="exportXls">导出</a></td>
		</tr>
	</table>
	</form>
	</div>
	<div region="center">
	<!-- datagrid信息表 -->	
	<table id="datagrid_table"></table>		
	</div>
	
	<!-- 修改记录 -->
	<div id="datagrid_update">
		<form id="update_form" action="userInfo/updateById.do" method="post">
			<input type="hidden" id="idUpdate" name="id"/>		
			<table width="630" class="xxl_tb_1">
				<tbody>
					<tr>
						<td class="xxl_td_2">账号：</td>
						<td  id="loginCodeUpdate"></td>
					</tr>
					
					<tr>
						<td class="xxl_td_2">姓名：</td>
						<td><input type="text" id="userNameUpdate" name="userName"/></td>		
					</tr>		
					<tr>
						<td class="xxl_td_2">手机号码：</td>
						<td ><input id="mobilePhoneUpdate" name="mobilePhone"  maxlength='11' /></td>						
					</tr>		
					<tr>
						<td class="xxl_td_2">身份证号码：</td>
						<td><input type="text" id="idCardUpdate" name="idCard" maxlength="18"/></td>					
					</tr>
					<tr>
						<td class="xxl_td_2">职业：</td>
						<td><input id="accupationUpdate" name="accupation" readonly="readonly" style="border:none" /></td>
					</tr>
					
					<tr>
						<td class="xxl_td_2">银行卡号：</td>
						<td><input type="text" id="bankAccountUpdate" name="bankAccount" /></td>
					</tr>
					<tr>
						<td  class="">所属银行：</td>
						<td><input type="text" id="bankTypeUpdate" name="bankType"/></td>
					</tr>
					<tr>
						<td class="xxl_td_2">个人推荐码：</td>
						<td><input type="text" id="recommendCodeUpdate" readonly="readonly" name="recommendCode" style="border:none"/></td>
						
					</tr>
									
					<tr>
						<td class="xxl_td_2">审核意见：</td>
						<td>
							<textarea rows="10" cols="35" id="auditOpinionUpdate" name="auditOpinion"></textarea>
						</td>
					</tr>
					
					<tr>
						<td colspan="3" style="text-align: center">
							<a class="easyui-linkbutton" iconCls="icon-ok" onclick="$('#update_form').submit();">通过审核</a>		
							<a class="easyui-linkbutton" iconCls="icon-cancel" onclick="$('#datagrid_update').window('close');">不通过审核</a>
						</td>
					</tr>
				</tbody>
			</table>
		</form>
	</div>
</body>
</html>